module jp_pbfil2
!$$$  module documentation block
!                .      .    .                                       .
! module:   jp_pbfil2
!   prgmmr: purser           org: NOAA/EMC            date: 2019-08
!
! abstract:  Module of data defining the exact transition rules
!            of the decad algorithm based on the PG(3,2) reference
!            geometry
!
! module history log:
!
! Subroutines Included:
!
! Functions Included:
!
! remarks:
!   An overview of this topic is given NOAA/NCEP Office Note 500.
!
! attributes:
!   language: f90
!   machine:
!
!$$$ end documentation block

use mpi
use jp_pkind, only: spi,dp
implicit none
public
private                                  :: X,   A,   B
integer(spi),parameter                   :: X=99,A=10,B=11
!---- Items that relate to beta line filters generally:
real(dp),allocatable,dimension(:)        :: bnorm,bsprds
integer(spi)                             :: p,nh
!---- Items that relate only to 4D "decad" line filters:
integer(spi),dimension(4,0:9)            :: dec0,dodec0t
integer(spi),dimension(4,0:11)           :: dodec0
integer(spi),dimension(0:14,0:14)        :: typ
integer(spi),dimension(0:3,0:3,0:9,0:11) :: umat10
integer(spi),dimension(0:3,0:3,0:3,12:59):: umat12
integer(spi),dimension(0:3,0:3,4:9)      :: umats
integer(spi),dimension(0:9,0:59)         :: nei
integer(spi),dimension(0:9,0:11)         :: dcol10
integer(spi),dimension(0:3,12:59)        :: dcol12
integer(spi),dimension(2,    0:3)        :: nei0a,jcora
integer(spi),dimension(2,1:2,4:9)        :: nei0b,jcorb
integer(spi),dimension(2)                :: nei17,nei22,nei33,nei38
integer(spi),dimension(4,4,0:12)         :: tcors
integer(spi),dimension(0:2,0:3)          :: kcor10a5
integer(spi),dimension(0:2,4:9)          :: kcor10b1,kcor10b2
integer(spi),dimension(12:59)            :: kcor12b0
integer(spi),dimension(0:2)              :: kcor17c0,kcor22c0,kcor33c0,kcor38c0, &
                                            kcor44c0,kcor51c0,kcor53c0,kcor58c0
integer(spi),dimension(0:9,0:2)          :: twt10a5,twt10b1,twt10b2,twt12c0
integer(spi),dimension(0:9,0:9)          :: qwt10a,qwt10b,qwt10c,qwt10d,qwt10e, &
                                            qwt12a,qwt12b
integer(spi),dimension(0:9,0:2)          :: qwt12b0
integer(spi),dimension(0:9,0:12)         :: tperms
integer(spi),dimension(0:9,0:9,0:11)     :: perm10
integer(spi),dimension(0:9,0:3,12:59)    :: perm12
integer(spi),dimension(0:9,4:9)          :: perms
data p/0/
data nh/0/
data dec0/1,0,0,0,   0,1, 0,0,  0, 0,1, 0,  0,0,0,1,  -1,-1,-1,-1,  &
          1,0,1,1,  -1,0,-1,0,  0,-1,0,-1,  1,1,0,1,  -1, 0, 0,-1/
data dodec0t/ &
     +2, 0, 0, 0,    0, 2, 0, 0,    0, 0, 2, 0,    0, 0, 0, 2, &
     -1,-1,-1,-1,    1, 1,-1,-1,    1,-1, 1,-1,                &
     -1, 1, 1, 1,   -1, 1,-1,-1,   -1,-1, 1,-1               /
data dodec0/ &
     +2, 0, 0, 0,    0, 2, 0, 0,    0, 0, 2, 0,    0, 0, 0, 2, &
     -1,-1,-1,-1,    1, 1,-1,-1,    1,-1, 1,-1,    1,-1,-1, 1, &
     -1, 1, 1, 1,   -1, 1,-1,-1,   -1,-1, 1,-1,   -1,-1,-1, 1/
data typ/ X,6,8,X,X,X,X,7,3,9,5,1,0,2,4, &! 3;1;1;1;9
          X,3,6,9,8,5,X,1,X,0,X,2,X,4,7, &! 6;2;2;2;3
          X,X,3,0,6,X,9,2,8,X,5,4,X,7,1, &! 1;4;4;3;3
          X,8,X,X,3,5,0,4,6,X,X,7,9,1,2, &! 2;1;6;1;5
!---------
          X,X,X,8,6,4,X,X,7,3,9,2,1,0,5, &! 1;1;4;1;8
          X,7,X,3,X,9,8,2,6,1,4,0,X,5,X, &! 2;2;8;2;1
          X,6,7,1,X,4,3,0,X,X,9,5,8,X,2, &! 4;4;1;4;2
          X,X,6,X,7,9,1,5,X,8,4,X,3,2,0, &! 1;2;5;3;4
!---------
          9,X,0,5,X,4,X,7,3,X,X,1,8,6,2, &! 3;2;3;1;6
          9,3,X,X,0,X,5,1,X,8,4,6,X,2,7, &! 1;2;3;4;5
!---------
          X,1,5,9,6,4,2,X,7,8,3,X,0,X,X, &! 4;2;1;1;7
!---------
          X,7,0,X,9,8,X,4,1,X,3,5,X,2,6, &! 3;3;3;3;3
!+++++++++
          X,1,X,4,2,3,5,B,X,A,0,9,8,7,6, &! 2;6;7
          X,X,1,A,X,0,4,9,2,8,3,7,5,6,B, &! 1;3;11
!---------
          X,0,3,B,2,X,4,7,1,5,X,8,9,6,A/  ! 5;5;5
data umat10/&
!----------------     0
 1, 1, 1, 1,   0, 1,-1, 1,   0, 0, 0, 1,  -1, 0, 0,-1,  &
 0, 0, 1, 0,  -2,-1,-1,-2,   0,-1, 0,-1,   0, 0, 0, 1,  &
 0, 0, 0, 1,  -1,-1,-1,-1,  -1,-1, 0,-1,   2, 0, 1, 1,  &
 1, 1, 1, 1,   1, 0, 0, 0,   1,-1, 1, 0,  -1, 0, 0,-1,  &
 1, 0, 0, 1,   0,-1, 0,-1,   1, 0, 1, 0,   0, 1,-1, 0,  &
 1, 1, 0, 1,   0,-1,-1, 0,   0, 0, 0, 1,   1, 0, 1, 0,  &
 1, 1, 0, 1,   0,-1,-1,-1,  -1, 0,-1,-1,   0, 0, 0, 1,  &
 0, 0, 1, 0,   0, 1, 0, 0,   2, 1, 1, 1,   0, 0, 0, 1,  &
 1, 0, 1, 1,  -1, 0, 0, 0,   0, 1, 0, 1,   0,-1,-1, 0,  &
 0, 1, 0, 1,  -1, 0,-1,-1,   1, 1, 0, 0,   0, 0, 1, 0,  &
!----------------     1
 1, 1, 1, 1,   0, 1,-1, 1,   0, 0, 0, 1,  -1, 0, 0,-1,  &
 0, 0, 1, 0,  -2,-1,-1,-2,   0,-1, 0,-1,   0, 0, 0, 1,  &
 0, 0, 0, 1,  -1,-1,-1,-1,  -1,-1, 0,-1,   2, 0, 1, 1,  &
 1, 1, 1, 1,  -1, 1,-1, 0,  -1, 0, 0, 0,   1, 0, 0, 1,  &
 1, 0, 0, 1,  -1, 0,-1, 0,   0, 1, 0, 1,   0,-1, 1, 0,  &
 1, 1, 0, 1,   1, 0, 1, 0,   0, 0, 0,-1,   0,-1,-1, 0,  &
 1, 1, 0, 1,   1, 0, 1, 1,   0, 1, 1, 1,   0, 0, 0,-1,  &
 0, 0, 1, 0,  -2,-1,-1,-1,   0,-1, 0, 0,   0, 0, 0,-1,  &
 1, 0, 1, 1,   0,-1, 0,-1,   1, 0, 0, 0,   0, 1, 1, 0,  &
 0, 1, 0, 1,  -1,-1, 0, 0,   1, 0, 1, 1,   0, 0,-1, 0,  &
!----------------     2
 1, 1, 1, 1,   0, 0, 0,-1,   0,-1, 1,-1,   1, 0, 0, 1,  &
 0, 0, 1, 0,   0, 1, 0, 1,   2, 1, 1, 2,   0, 0, 0,-1,  &
 0, 0, 0, 1,   1, 1, 0, 1,   1, 1, 1, 1,  -2, 0,-1,-1,  &
 1, 1, 1, 1,  -1, 1,-1, 0,  -1, 0, 0, 0,   1, 0, 0, 1,  &
 1, 0, 0, 1,  -1, 0,-1, 0,   0, 1, 0, 1,   0,-1, 1, 0,  &
 1, 1, 0, 1,   0,-1,-1, 0,   0, 0, 0, 1,   1, 0, 1, 0,  &
 1, 1, 0, 1,   1, 0, 1, 1,   0, 1, 1, 1,   0, 0, 0,-1,  &
 0, 0, 1, 0,  -2,-1,-1,-1,   0,-1, 0, 0,   0, 0, 0,-1,  &
 1, 0, 1, 1,   0,-1, 0,-1,   1, 0, 0, 0,   0, 1, 1, 0,  &
 0, 1, 0, 1,  -1,-1, 0, 0,   1, 0, 1, 1,   0, 0,-1, 0,  &
 !----------------     3
 1, 1, 1, 1,   0, 0, 0,-1,   0,-1, 1,-1,   1, 0, 0, 1,  &
 0, 0, 1, 0,   0, 1, 0, 1,   2, 1, 1, 2,   0, 0, 0,-1,  &
 0, 0, 0, 1,   1, 1, 0, 1,   1, 1, 1, 1,  -2, 0,-1,-1,  &
 1, 1, 1, 1,   1, 0, 0, 0,   1,-1, 1, 0,  -1, 0, 0,-1,  &
 1, 0, 0, 1,   0,-1, 0,-1,   1, 0, 1, 0,   0, 1,-1, 0,  &
 1, 1, 0, 1,   1, 0, 1, 0,   0, 0, 0,-1,   0,-1,-1, 0,  &
 1, 1, 0, 1,   0,-1,-1,-1,  -1, 0,-1,-1,   0, 0, 0, 1,  &
 0, 0, 1, 0,   0, 1, 0, 0,   2, 1, 1, 1,   0, 0, 0, 1,  &
 1, 0, 1, 1,  -1, 0, 0, 0,   0, 1, 0, 1,   0,-1,-1, 0,  &
 0, 1, 0, 1,  -1, 0,-1,-1,   1, 1, 0, 0,   0, 0, 1, 0,  &
!----------------     4
 1, 0, 1, 1,   0,-1, 0,-1,  -1,-1, 0,-1,   0, 0,-1, 1,  &
 1, 0, 1, 0,  -1,-1,-1,-2,  -1, 0, 0,-1,   1, 1, 0, 1,  &
 0, 0, 0, 1,   2, 0, 1, 1,   1, 1, 0, 1,  -1,-1,-1,-1,  &
 0, 0, 1, 0,   0, 1, 0, 0,  -2, 0,-1,-1,   0,-1, 0,-1,  &
 0, 0, 0, 1,   0, 0, 1, 0,   1,-1, 1, 0,   1, 1, 0, 1,  &
 1, 1, 0, 1,   1, 0, 1, 0,   0, 0, 0,-1,   0,-1,-1, 0,  &
 1, 0, 0, 1,   0,-1, 0,-1,   0, 0,-1,-1,   1, 1, 1, 1,  &
 1, 0, 0, 1,   1, 1, 0, 0,   1, 0, 1, 0,  -1,-1,-1,-1,  &
 1, 0, 1, 0,   0,-1,-1,-1,   0,-1, 0, 0,  -1, 0, 0,-1,  &
 0, 1, 0, 1,   0, 0,-1, 0,   1, 1, 0, 0,   1, 0, 1, 1,  &
!----------------     5
 1, 0, 1, 1,   0,-1, 0,-1,  -1,-1, 0,-1,   0, 0,-1, 1,  &
 1, 0, 1, 0,   1, 1, 0, 1,   1, 0, 0, 1,  -1,-1,-1,-2,  &
 0, 0, 0, 1,  -1,-1,-1,-1,  -1,-1, 0,-1,   2, 0, 1, 1,  &
 0, 0, 1, 0,   0, 1, 0, 0,  -2, 0,-1,-1,   0,-1, 0,-1,  &
 0, 0, 0, 1,  -1, 1,-1, 0,   0, 0,-1, 0,  -1,-1, 0,-1,  &
 1, 1, 0, 1,   1, 0, 1, 0,   0, 0, 0,-1,   0,-1,-1, 0,  &
 1, 0, 0, 1,   0, 0, 1, 1,   0, 1, 0, 1,  -1,-1,-1,-1,  &
 1, 0, 0, 1,   1, 1, 0, 0,   1, 0, 1, 0,  -1,-1,-1,-1,  &
 1, 0, 1, 0,   0, 1, 0, 0,   0, 1, 1, 1,   1, 0, 0, 1,  &
 0, 1, 0, 1,  -1,-1, 0, 0,   0, 0, 1, 0,  -1, 0,-1,-1,  &
!----------------     6
 1, 0, 1, 1,   1, 1, 0, 1,   0, 1, 0, 1,   0, 0, 1,-1,  &
 1, 0, 0, 0,   1, 1, 1, 1,   1, 1, 0, 2,  -1, 0,-1,-1,  &
 0, 0, 0, 1,   2, 0, 1, 1,   1, 1, 0, 1,  -1,-1,-1,-1,  &
 0, 0, 1, 0,   2, 0, 1, 1,   0,-1, 0, 0,   0, 1, 0, 1,  &
 0, 0, 0, 1,  -1, 1,-1, 0,   0, 0,-1, 0,  -1,-1, 0,-1,  &
 1, 1, 0, 1,   0, 0, 0, 1,  -1, 0,-1, 0,   0, 1, 1, 0,  &
 1, 0, 0, 1,   0, 0, 1, 1,   0, 1, 0, 1,  -1,-1,-1,-1,  &
 1, 0, 0, 1,  -1, 0,-1, 0,  -1,-1, 0, 0,   1, 1, 1, 1,  &
 1, 0, 1, 0,   0, 1, 0, 0,   0, 1, 1, 1,   1, 0, 0, 1,  &
 0, 1, 0, 1,  -1,-1, 0, 0,   0, 0, 1, 0,  -1, 0,-1,-1,  &
!----------------     7
 1, 0, 1, 1,   1, 1, 0, 1,   0, 1, 0, 1,   0, 0, 1,-1,  &
 1, 0, 1, 0,   1, 1, 0, 1,   1, 0, 0, 1,  -1,-1,-1,-2,  &
 0, 1, 0, 1,   2, 1, 1, 1,   1, 0, 1, 1,  -1, 0, 0,-1,  &
 0, 0, 1, 0,   2, 0, 1, 1,   0,-1, 0, 0,   0, 1, 0, 1,  &
 0, 0, 0, 1,   0, 0, 1, 0,   1,-1, 1, 0,   1, 1, 0, 1,  &
 1, 1, 0, 1,   0, 0, 0, 1,  -1, 0,-1, 0,   0, 1, 1, 0,  &
 1, 0, 0, 1,   0,-1, 0,-1,   0, 0,-1,-1,   1, 1, 1, 1,  &
 1, 0, 0, 1,  -1, 0,-1, 0,  -1,-1, 0, 0,   1, 1, 1, 1,  &
 1, 0, 1, 0,   0,-1,-1,-1,   0,-1, 0, 0,  -1, 0, 0,-1,  &
 0, 1, 0, 1,   0, 0,-1, 0,   1, 1, 0, 0,   1, 0, 1, 1,  &
!----------------     8
 1, 0, 1, 1,   1, 1, 0, 1,   0, 1, 0, 1,   0, 0, 1,-1,  &
 1, 0, 0, 0,  -1,-1, 0,-2,  -1,-1,-1,-1,   1, 0, 1, 1,  &
 0, 0, 0, 1,  -2, 0,-1,-1,  -1,-1,-1,-1,   1, 1, 0, 1,  &
 1, 1, 0, 1,  -1, 0,-1, 0,  -1, 0,-1,-1,   1,-1, 0, 0,  &
 1, 0, 0, 1,   1, 0, 1, 0,   0,-1, 0,-1,   0, 1,-1, 0,  &
 1, 0, 0, 0,   0,-1, 0, 0,   0, 0,-1, 1,   1, 1, 1, 1,  &
 0, 1, 0, 0,   0, 0, 1, 0,   1, 1, 1, 2,   1, 0, 0, 0,  &
 0, 0, 1, 0,  -2,-1,-1,-1,   0,-1, 0, 0,   0, 0, 0,-1,  &
 0, 0, 0, 1,  -1, 1, 0, 0,   0, 0, 1, 0,  -1,-1,-1,-1,  &
 1, 1, 1, 1,   1, 0, 0, 0,   0, 0, 0,-1,   0,-1, 1, 0,  &
!----------------     9
 1, 0, 1, 1,   1, 1, 0, 1,   0, 1, 0, 1,   0, 0, 1,-1,  &
 1, 0, 0, 0,   1, 0, 1, 1,   1, 1, 1, 1,  -1,-1, 0,-2,  &
 0, 1, 0, 0,   2, 1, 1, 2,   1, 0, 0, 0,  -1, 0,-1, 0,  &
 1, 1, 0, 1,  -1, 0,-1, 0,  -1, 0,-1,-1,   1,-1, 0, 0,  &
 1, 0, 0, 1,   0, 1, 0, 1,  -1, 0,-1, 0,   0,-1, 1, 0,  &
 1, 0, 0, 0,   0,-1, 0, 0,   0, 0,-1, 1,   1, 1, 1, 1,  &
 0, 1, 0, 0,  -1,-1,-1,-2,   0, 0,-1, 0,  -1, 0, 0, 0,  &
 0, 0, 1, 0,   0, 1, 0, 0,   2, 1, 1, 1,   0, 0, 0, 1,  &
 0, 0, 0, 1,  -1, 1, 0, 0,   0, 0, 1, 0,  -1,-1,-1,-1,  &
 1, 1, 1, 1,   0, 0, 0, 1,  -1, 0, 0, 0,   0, 1,-1, 0,  &
!----------------    10
 0, 1, 0, 0,   1, 1, 0, 2,  -1, 0,-1, 0,   0, 0, 1, 0,  &
 1, 0, 1, 0,   1, 0, 0, 1,   1, 1, 1, 2,  -1,-1, 0,-1,  &
 0, 1, 0, 1,  -2,-1,-1,-1,  -1, 0,-1,-1,   1, 0, 0, 1,  &
 1, 1, 1, 1,  -1, 0, 0,-1,  -1, 0, 0, 0,   1,-1, 1, 0,  &
 0, 0, 0, 1,   1, 1, 0, 1,   0, 0,-1, 0,   1,-1, 1, 0,  &
 0, 1, 0, 1,   0, 0,-1, 0,  -1,-1,-1, 0,  -1, 0, 0,-1,  &
 0, 1, 0, 0,  -1,-1,-1,-2,   1, 0, 0, 0,   0, 0, 1, 0,  &
 1, 0, 1, 1,   1, 1, 1, 0,   1, 1, 0, 1,  -1, 0, 0, 0,  &
 1, 0, 1, 1,   0, 1, 0, 1,   0, 1, 1, 0,   1, 0, 0, 0,  &
 1, 0, 1, 0,   0, 1, 0, 0,   0, 0,-1,-1,  -1,-1, 0,-1,  &
!----------------    11
 1, 1, 1, 1,  -1, 0, 0,-1,   0, 0, 0,-1,   0, 1,-1, 1,  &
 0, 0, 1, 0,   0, 0, 0,-1,   0,-1, 0,-1,   2, 1, 1, 2,  &
 0, 1, 0, 0,  -1, 0,-1, 0,  -1, 0, 0, 0,   2, 1, 1, 2,  &
 1, 1, 0, 1,  -1, 0,-1,-1,  -1, 0,-1, 0,   1,-1, 0, 0,  &
 1, 0, 0, 0,   0, 1, 0, 0,  -1, 0,-1,-1,   0,-1, 1,-1,  &
 0, 1, 0, 1,   0, 0, 1, 0,  -1, 0, 0,-1,  -1,-1,-1, 0,  &
 1, 0, 0, 1,   0, 1, 0, 1,   1, 1, 1, 1,   0, 0,-1,-1,  &
 1, 0, 1, 1,   1, 0, 0, 0,   1, 1, 0, 1,  -1,-1,-1, 0,  &
 0, 0, 0, 1,   1, 1, 1, 1,   0, 0, 1, 0,   1,-1, 0, 0,  &
 1, 0, 1, 0,   1, 1, 0, 1,   0, 1, 0, 0,   0, 0, 1, 1/
data umat12/&
!----------------    12
 0, 2,-2, 0,   1, 1, 1, 1,  -1, 1, 1, 1,   0, 0, 0,-2,  &
 1, 1,-1, 1,   0, 0, 2, 2,  -2, 0, 0, 0,   0, 0, 0,-2,  &
 1, 1,-1,-1,   0,-2, 0,-2,  -2, 0, 0, 0,   0, 0, 0, 2,  &
 0, 0, 2, 0,  -1, 1,-1,-1,  -1, 1,-1, 1,   0,-2, 0, 0,  &
!----------------    13
 0, 0, 2, 2,  -1,-1, 1,-1,   1,-1, 1,-1,   0, 2, 0, 0,  &
 1, 1, 1, 1,   1,-1, 1, 1,   0, 0,-2, 0,  -2, 0, 0, 0,  &
 1, 1,-1, 1,   1,-1, 1, 1,  -1, 1, 1, 1,   0, 0, 0,-2,  &
 0, 2,-2, 0,  -1, 1, 1, 1,   1,-1, 1, 1,   1,-1, 1,-1,  &
!----------------    14
 0, 2, 0, 2,   0, 0, 2, 0,  -1,-1, 1, 1,  -1, 1,-1,-1,  &
 1,-1,-1,-1,  -1,-1, 1,-1,  -1, 1,-1,-1,   1, 1, 1, 1,  &
 1, 1,-1,-1,   0,-2, 0,-2,   1,-1, 1, 1,  -1, 1, 1, 1,  &
 1,-1,-1,-1,  -1,-1, 1,-1,  -1,-1, 1, 1,   1, 1, 1, 1,  &
!----------------    15
 0, 2, 0, 2,   1, 1,-1,-1,   0, 0,-2, 0,   1,-1, 1, 1,  &
 1, 1,-1, 1,   1,-1, 1, 1,   0, 0, 2, 0,  -2, 0, 0, 0,  &
 1,-1,-1,-1,  -1, 1,-1, 1,   0, 2, 0, 0,  -1,-1, 1,-1,  &
 1,-1,-1,-1,   1,-1, 1, 1,  -1, 1,-1, 1,   0, 2, 0, 0,  &
!----------------    16
 0, 0, 2, 2,  -1,-1, 1,-1,   0,-2, 0, 0,  -1, 1,-1, 1,  &
 0, 0, 2, 0,   2, 0, 0, 0,   0, 0, 0, 2,  -1,-1,-1,-1,  &
 1, 1, 1, 1,  -1,-1, 1, 1,  -1, 1,-1, 1,   1,-1,-1,-1,  &
 1, 1, 1, 1,  -1,-1, 1, 1,  -1,-1, 1,-1,   1,-1,-1,-1,  &
!----------------    17
 0, 2, 0, 2,  -1, 1,-1,-1,   0, 0,-2, 0,  -1,-1, 1, 1,  &
 1,-1, 1, 1,   0, 0, 2, 0,  -2, 0, 0, 0,   0, 0,-2,-2,  &
 1, 1,-1, 1,   0,-2, 0, 0,  -2, 0, 0, 0,   0, 0, 0,-2,  &
 0, 0, 2, 0,  -1,-1, 1, 1,   1, 1,-1, 1,   1,-1,-1,-1,  &
 !----------------    18
 0, 2,-2, 0,  -1, 1, 1, 1,   1, 1, 1, 1,   0, 0, 0,-2,  &
 0, 0, 2, 2,  -1,-1, 1,-1,  -1, 1,-1,-1,   0, 0,-2, 0,  &
 0, 2, 0, 2,   1, 1,-1,-1,   1,-1, 1,-1,   0,-2, 0, 0,  &
 0, 0, 2, 0,  -2, 0, 0, 0,   0, 2,-2, 0,   1,-1,-1,-1,  &
!----------------    19
 0, 2,-2, 0,   0, 0, 0,-2,  -1,-1,-1,-1,  -1, 1, 1, 1,  &
 1, 1,-1,-1,  -1, 1, 1, 1,   0, 0, 0, 2,  -1,-1,-1,-1,  &
 1, 1,-1, 1,   0, 2, 0, 0,   1,-1, 1,-1,  -1,-1, 1, 1,  &
 1,-1, 1, 1,   1,-1, 1,-1,  -1,-1,-1,-1,   0, 2,-2, 0,  &
!----------------    20
 0, 2, 0, 2,   1,-1, 1, 1,  -1,-1, 1, 1,   0, 0,-2, 0,  &
 1, 1,-1,-1,   1,-1, 1,-1,  -1,-1,-1,-1,   0, 0, 0, 2,  &
 2, 0, 0, 0,   0,-2, 0, 0,  -1, 1,-1, 1,  -1, 1, 1, 1,  &
 0, 2,-2, 0,  -1,-1,-1,-1,   1,-1, 1,-1,   1,-1, 1, 1,  &
!----------------    21
 0, 2,-2, 0,  -1,-1,-1,-1,   1,-1,-1,-1,   0, 0, 0, 2,  &
 1, 1,-1,-1,   0, 0, 2, 0,  -2, 0, 0, 0,   0, 0, 0, 2,  &
 1, 1,-1, 1,   0,-2, 0, 0,  -2, 0, 0, 0,   0, 0, 0,-2,  &
 1,-1,-1,-1,   1,-1, 1, 1,   0, 0, 2, 0,  -2, 0, 0, 0,  &
!----------------    22
 0, 0, 2, 2,   1,-1, 1,-1,   0,-2, 0, 0,   1, 1,-1, 1,  &
 0, 0, 0, 2,  -2, 0, 0, 0,   0, 0, 2, 0,   1, 1,-1,-1,  &
 1,-1, 1,-1,   0,-2, 0, 0,  -2, 0, 0, 0,   0, 2, 0, 2,  &
 0, 2, 0, 0,   1, 1,-1, 1,  -1,-1, 1, 1,  -1,-1,-1,-1,  &
!----------------    23
 0, 2, 0, 2,   0, 0, 2, 0,  -1,-1, 1, 1,  -1, 1,-1,-1,  &
 1, 1,-1,-1,  -1, 1,-1, 1,   0, 0, 2, 2,  -1,-1, 1,-1,  &
 1,-1,-1,-1,  -1, 1,-1, 1,  -1,-1, 1, 1,   1, 1, 1, 1,  &
 1,-1, 1, 1,   1,-1,-1,-1,   0, 2,-2, 0,  -2, 0, 0, 0,  &
!----------------    24
 0, 0, 2, 2,   0, 2, 0, 0,   1, 1,-1, 1,   1,-1, 1,-1,  &
 1, 1, 1, 1,  -1, 1,-1,-1,   0, 0,-2, 0,  -1,-1, 1, 1,  &
 1, 1,-1,-1,   1,-1, 1,-1,   0,-2, 0, 0,  -2, 0, 0, 0,  &
 1, 1, 1, 1,   1,-1, 1,-1,  -1, 1,-1,-1,   0, 0,-2, 0,  &
!----------------    25
 0, 0, 2, 2,  -1,-1, 1,-1,   0,-2, 0, 0,  -1, 1,-1, 1,  &
 1, 1, 1, 1,  -1, 1,-1,-1,  -1,-1, 1,-1,   1,-1,-1,-1,  &
 0, 0, 0, 2,  -1, 1, 1, 1,   1,-1, 1,-1,   1, 1,-1,-1,  &
 1,-1, 1,-1,   1, 1, 1, 1,   0, 2,-2, 0,  -2, 0, 0, 0,  &
!----------------    26
 0, 2,-2, 0,   1,-1,-1,-1,   0, 0, 0,-2,   1, 1, 1, 1,  &
 1, 1,-1,-1,   0, 0,-2, 0,   1,-1, 1, 1,  -1,-1, 1,-1,  &
 1, 1,-1, 1,  -1,-1,-1,-1,   0, 0, 0,-2,  -1, 1, 1, 1,  &
 0, 2,-2, 0,  -1, 1, 1, 1,   1,-1, 1, 1,   1,-1, 1,-1,  &
!----------------    27
 0, 2,-2, 0,   1, 1, 1, 1,  -1, 1, 1, 1,   0, 0, 0,-2,  &
 0, 0, 2, 0,  -1,-1, 1, 1,  -1, 1,-1, 1,   0, 0,-2,-2,  &
 0, 2, 0, 0,   1, 1,-1, 1,   1,-1, 1, 1,   0,-2, 0,-2,  &
 1,-1,-1,-1,  -1, 1,-1,-1,  -1, 1,-1, 1,   1, 1, 1, 1,  &
!----------------    28
 0, 2,-2, 0,   1, 1, 1, 1,  -1, 1, 1, 1,   0, 0, 0,-2,  &
 1, 1,-1, 1,   0, 0, 2, 2,  -2, 0, 0, 0,   0, 0, 0,-2,  &
 1, 1,-1,-1,   0,-2, 0,-2,  -2, 0, 0, 0,   0, 0, 0, 2,  &
 0, 2, 0, 0,   1,-1, 1,-1,   1,-1, 1, 1,   0, 0,-2, 0,  &
!----------------    29
 0, 0, 2, 2,  -1,-1, 1,-1,   1,-1, 1,-1,   0, 2, 0, 0,  &
 1, 1, 1, 1,   1,-1, 1, 1,   0, 0,-2, 0,  -2, 0, 0, 0,  &
 1, 1,-1, 1,   1,-1, 1, 1,  -1, 1, 1, 1,   0, 0, 0,-2,  &
 0, 2,-2, 0,  -1, 1, 1, 1,   1,-1, 1, 1,   1,-1, 1,-1,  &
!----------------    30
 0, 2, 0, 2,   0, 0, 2, 0,  -1,-1, 1, 1,  -1, 1,-1,-1,  &
 1,-1,-1,-1,  -1,-1, 1,-1,  -1, 1,-1,-1,   1, 1, 1, 1,  &
 1,-1, 1, 1,  -1,-1, 1,-1,   0, 2, 0, 0,  -1, 1,-1, 1,  &
 1,-1,-1,-1,  -1,-1, 1,-1,  -1,-1, 1, 1,   1, 1, 1, 1,  &
!----------------    31
 0, 2, 0, 2,   0, 0, 2, 0,  -1,-1, 1, 1,  -1, 1,-1,-1,  &
 1, 1,-1, 1,   1,-1, 1, 1,   0, 0, 2, 0,  -2, 0, 0, 0,  &
 1,-1,-1,-1,  -1, 1,-1, 1,   0, 2, 0, 0,  -1,-1, 1,-1,  &
 1,-1,-1,-1,   1,-1, 1, 1,  -1, 1,-1, 1,   0, 2, 0, 0,  &
!----------------    32
 0, 0, 2, 2,  -1,-1, 1,-1,   0,-2, 0, 0,  -1, 1,-1, 1,  &
 0, 0, 0, 2,   1,-1,-1,-1,  -1,-1, 1,-1,  -1, 1,-1,-1,  &
 1, 1, 1, 1,  -1,-1, 1, 1,  -1, 1,-1, 1,   1,-1,-1,-1,  &
 1, 1, 1, 1,  -1,-1, 1, 1,  -1,-1, 1,-1,   1,-1,-1,-1,  &
!----------------    33
 0, 2, 0, 2,  -1,-1, 1, 1,   0, 0, 2, 0,  -1, 1,-1,-1,  &
 1,-1, 1, 1,   0, 0, 2, 0,  -2, 0, 0, 0,   0, 0,-2,-2,  &
 0, 0, 0, 2,   2, 0, 0, 0,   0, 2, 0, 0,  -1,-1, 1,-1,  &
 0, 0, 2, 0,  -1,-1, 1, 1,   1, 1,-1, 1,   1,-1,-1,-1,  &
!----------------    34
 0, 2,-2, 0,  -1,-1,-1,-1,   1,-1,-1,-1,   0, 0, 0, 2,  &
 0, 0, 2, 2,  -1,-1, 1,-1,  -1, 1,-1,-1,   0, 0,-2, 0,  &
 0, 2, 0, 2,   1, 1,-1,-1,   1,-1, 1,-1,   0,-2, 0, 0,  &
 1,-1, 1, 1,  -1, 1, 1, 1,  -1,-1, 1,-1,   1, 1,-1,-1,  &
!----------------    35
 0, 2,-2, 0,   0, 0, 0,-2,  -1,-1,-1,-1,  -1, 1, 1, 1,  &
 1, 1,-1,-1,  -1, 1, 1, 1,   0, 0, 0, 2,  -1,-1,-1,-1,  &
 1, 1,-1, 1,   0, 2, 0, 0,   1,-1, 1,-1,  -1,-1, 1, 1,  &
 1,-1, 1, 1,   1,-1, 1,-1,  -1,-1,-1,-1,   0, 2,-2, 0,  &
!----------------    36
 0, 2, 0, 2,   1,-1, 1, 1,  -1,-1, 1, 1,   0, 0,-2, 0,  &
 1, 1,-1,-1,   1,-1, 1,-1,  -1,-1,-1,-1,   0, 0, 0, 2,  &
 2, 0, 0, 0,   0,-2, 0, 0,  -1, 1,-1, 1,  -1, 1, 1, 1,  &
 0, 2,-2, 0,  -1,-1,-1,-1,   1,-1, 1,-1,   1,-1, 1, 1,  &
!----------------    37
 0, 2,-2, 0,  -1, 1, 1, 1,   1, 1, 1, 1,   0, 0, 0,-2,  &
 1, 1,-1,-1,   0, 0, 2, 0,  -2, 0, 0, 0,   0, 0, 0, 2,  &
 1, 1,-1, 1,   0,-2, 0, 0,  -2, 0, 0, 0,   0, 0, 0,-2,  &
 0, 0, 2, 0,  -1,-1, 1, 1,  -1,-1,-1,-1,   0, 2,-2, 0,  &
!----------------    38
 0, 2, 0, 2,   1, 1,-1,-1,  -1, 1,-1,-1,   0, 0, 2, 0,  &
 1, 1,-1,-1,   0, 0, 2, 0,  -2, 0, 0, 0,   0, 0, 0, 2,  &
 1,-1, 1,-1,   0,-2, 0, 0,  -2, 0, 0, 0,   0, 2, 0, 2,  &
 0, 2, 0, 0,   1, 1,-1, 1,  -1,-1, 1, 1,  -1,-1,-1,-1,  &
!----------------    39
 0, 2, 0, 2,   1, 1,-1,-1,   0, 0,-2, 0,   1,-1, 1, 1,  &
 0, 0, 2, 2,  -2, 0, 0, 0,   0, 0, 0,-2,   1,-1,-1,-1,  &
 1,-1,-1,-1,  -1, 1,-1, 1,  -1,-1, 1, 1,   1, 1, 1, 1,  &
 1,-1, 1, 1,   1,-1,-1,-1,   0, 2,-2, 0,  -2, 0, 0, 0,  &
!----------------    40
 0, 0, 2, 2,  -1,-1, 1,-1,   0,-2, 0, 0,  -1, 1,-1, 1,  &
 1, 1, 1, 1,  -1, 1,-1,-1,   0, 0,-2, 0,  -1,-1, 1, 1,  &
 1, 1,-1,-1,   1,-1, 1,-1,   0,-2, 0, 0,  -2, 0, 0, 0,  &
 1, 1, 1, 1,   1,-1, 1,-1,  -1, 1,-1,-1,   0, 0,-2, 0,  &
!----------------    41
 0, 0, 2, 2,   0, 2, 0, 0,   1, 1,-1, 1,   1,-1, 1,-1,  &
 1, 1, 1, 1,  -1, 1,-1,-1,  -1,-1, 1,-1,   1,-1,-1,-1,  &
 1,-1, 1,-1,   0, 2, 0, 0,   1, 1,-1, 1,  -1,-1,-1,-1,  &
 1,-1, 1,-1,   1, 1, 1, 1,   0, 2,-2, 0,  -2, 0, 0, 0,  &
!----------------    42
 0, 2,-2, 0,   1,-1,-1,-1,   0, 0, 0,-2,   1, 1, 1, 1,  &
 1, 1,-1,-1,   0, 0,-2, 0,   1,-1, 1, 1,  -1,-1, 1,-1,  &
 1, 1,-1, 1,  -1,-1,-1,-1,   0, 0, 0,-2,  -1, 1, 1, 1,  &
 0, 2,-2, 0,  -1, 1, 1, 1,   1,-1, 1, 1,   1,-1, 1,-1,  &
 !----------------    43
 0, 2,-2, 0,   1, 1, 1, 1,  -1, 1, 1, 1,   0, 0, 0,-2,  &
 0, 0, 2, 0,  -1,-1, 1, 1,  -1, 1,-1, 1,   0, 0,-2,-2,  &
 0, 2, 0, 0,   1, 1,-1, 1,   1,-1, 1, 1,   0,-2, 0,-2,  &
 1, 1, 1, 1,  -1, 1,-1, 1,  -1, 1,-1,-1,   1,-1,-1,-1,  &
!----------------    44
 0, 2,-2, 0,  -1, 1, 1, 1,   0, 0, 0, 2,  -1,-1,-1,-1,  &
 1,-1, 1,-1,   0, 0, 2, 2,  -2, 0, 0, 0,   0, 0,-2, 0,  &
 0, 0, 0, 2,  -2, 0, 0, 0,   0,-2, 0,-2,   1, 1,-1,-1,  &
 1, 1, 1, 1,   0, 2,-2, 0,  -2, 0, 0, 0,   0,-2, 0, 0,  &
!----------------    45
 0, 0, 2, 2,   0,-2, 0, 0,  -1,-1, 1,-1,  -1, 1,-1, 1,  &
 1,-1,-1,-1,   1, 1,-1, 1,   0, 0, 2, 2,  -2, 0, 0, 0,  &
 2, 0, 0, 0,   0, 0, 0,-2,  -1, 1, 1, 1,  -1, 1,-1, 1,  &
 1, 1,-1,-1,  -1,-1,-1,-1,   0,-2, 2, 0,  -1, 1, 1, 1,  &
!----------------    46
 0, 2, 0, 2,   0, 0,-2, 0,   1, 1,-1,-1,   1,-1, 1, 1,  &
 1, 1,-1, 1,  -1, 1,-1,-1,   0, 0, 2, 0,  -1,-1, 1, 1,  &
 1,-1, 1, 1,   0,-2, 0,-2,   1, 1,-1,-1,  -1, 1,-1, 1,  &
 1, 1, 1, 1,   0, 2,-2, 0,   1,-1,-1,-1,  -1,-1, 1,-1,  &
!----------------    47
 0, 2, 0, 2,   0, 0, 2, 0,   1,-1, 1, 1,   1, 1,-1,-1,  &
 1, 1,-1, 1,   0, 0, 2, 2,   1,-1, 1,-1,  -1,-1,-1,-1,  &
 1,-1,-1,-1,  -1, 1,-1,-1,   0, 2, 0, 2,  -1,-1, 1, 1,  &
 1, 1, 1, 1,  -1,-1, 1, 1,   0, 0,-2, 0,  -1, 1,-1,-1,  &
!----------------    48
 0, 2,-2, 0,  -1, 1, 1, 1,   1, 1, 1, 1,   0, 0, 0,-2,  &
 1, 1,-1,-1,   1,-1, 1,-1,   0, 0, 2, 2,  -2, 0, 0, 0,  &
 2, 0, 0, 0,   0, 2, 0, 2,  -1, 1,-1,-1,  -1,-1, 1,-1,  &
 1, 1, 1, 1,   1,-1, 1,-1,  -1, 1,-1,-1,   0, 0,-2, 0,  &
!----------------    49
 0, 0, 2, 2,  -1, 1,-1, 1,   1, 1,-1, 1,   0,-2, 0, 0,  &
 1, 1,-1, 1,   1,-1,-1,-1,  -1,-1, 1, 1,   0, 0, 2, 0,  &
 2, 0, 0, 0,   0, 2, 0, 2,  -1,-1, 1, 1,  -1,-1,-1,-1,  &
 1,-1, 1, 1,   1,-1,-1,-1,   0, 2,-2, 0,  -2, 0, 0, 0,  &
!----------------    50
 0, 2,-2, 0,   1, 1, 1, 1,   0, 0, 0, 2,   1,-1,-1,-1,  &
 1,-1, 1, 1,  -1,-1, 1,-1,   0, 0,-2,-2,  -1, 1,-1, 1,  &
 2, 0, 0, 0,   0,-2, 0, 0,  -1, 1,-1, 1,  -1, 1, 1, 1,  &
 1,-1, 1,-1,   1, 1, 1, 1,   0, 2,-2, 0,  -2, 0, 0, 0,  &
!----------------    51
 0, 0, 2, 2,  -1,-1, 1,-1,   0,-2, 0, 0,  -1, 1,-1, 1,  &
 1, 1,-1, 1,   0, 0, 2, 2,  -2, 0, 0, 0,   0, 0, 0,-2,  &
 0, 2, 0, 0,  -2, 0, 0, 0,   0,-2, 0,-2,   1,-1, 1, 1,  &
 0, 0, 2, 0,  -2, 0, 0, 0,   0, 2,-2, 0,   1,-1,-1,-1,  &
!----------------    52
 0, 0, 2, 2,   1, 1,-1, 1,   0, 2, 0, 0,   1,-1, 1,-1,  &
 1,-1,-1,-1,   1, 1,-1, 1,   0, 0, 2, 2,  -2, 0, 0, 0,  &
 2, 0, 0, 0,   0, 0, 0,-2,  -1, 1, 1, 1,  -1, 1,-1, 1,  &
 1, 1,-1,-1,  -1,-1,-1,-1,   0,-2, 2, 0,  -1, 1, 1, 1,  &
!----------------    53
 0, 2,-2, 0,  -1, 1, 1, 1,   0, 0, 0, 2,  -1,-1,-1,-1,  &
 0, 0, 2, 0,   2, 0, 0, 0,   0, 0,-2,-2,  -1, 1,-1, 1,  &
 0, 0, 0, 2,  -2, 0, 0, 0,   0,-2, 0,-2,   1, 1,-1,-1,  &
 1, 1, 1, 1,   0, 2,-2, 0,  -2, 0, 0, 0,   0,-2, 0, 0,  &
!----------------    54
 0, 2, 0, 2,  -1, 1,-1,-1,   0, 0,-2, 0,  -1,-1, 1, 1,  &
 1, 1,-1, 1,   0, 0, 2, 2,   1,-1, 1,-1,  -1,-1,-1,-1,  &
 1, 1,-1,-1,   0,-2, 0,-2,   1,-1, 1, 1,  -1, 1, 1, 1,  &
 1, 1, 1, 1,  -1,-1, 1, 1,   0, 0,-2, 0,  -1, 1,-1,-1,  &
!----------------    55
 0, 2, 0, 2,  -1,-1, 1, 1,   0, 0, 2, 0,  -1, 1,-1,-1,  &
 1, 1,-1, 1,  -1, 1,-1,-1,   0, 0, 2, 0,  -1,-1, 1, 1,  &
 1,-1, 1,-1,  -1,-1, 1, 1,   0, 2, 0, 2,  -1, 1,-1,-1,  &
 1, 1, 1, 1,   0, 2,-2, 0,   1,-1,-1,-1,  -1,-1, 1,-1,  &
!----------------    56
 0, 0, 2, 2,  -1,-1, 1,-1,   1,-1, 1,-1,   0, 2, 0, 0,  &
 1, 1,-1, 1,   1,-1,-1,-1,  -1,-1, 1, 1,   0, 0, 2, 0,  &
 2, 0, 0, 0,   0, 2, 0, 2,  -1,-1, 1, 1,  -1,-1,-1,-1,  &
 2, 0, 0, 0,   0,-2, 2, 0,  -1, 1, 1, 1,  -1, 1,-1,-1,  &
!----------------    57
 0, 2,-2, 0,  -1,-1,-1,-1,   1,-1,-1,-1,   0, 0, 0, 2,  &
 2, 0, 0, 0,   0, 0,-2,-2,  -1, 1,-1, 1,  -1,-1, 1, 1,  &
 2, 0, 0, 0,   0, 2, 0, 2,  -1, 1,-1,-1,  -1,-1, 1,-1,  &
 1, 1, 1, 1,   1,-1, 1,-1,  -1, 1,-1,-1,   0, 0,-2, 0,  &
!----------------    58
 0, 2,-2, 0,   1, 1, 1, 1,  -1, 1, 1, 1,   0, 0, 0,-2,  &
 1, 1,-1, 1,   0, 0, 2, 2,  -2, 0, 0, 0,   0, 0, 0,-2,  &
 0, 2, 0, 0,  -2, 0, 0, 0,   0,-2, 0,-2,   1,-1, 1, 1,  &
 1,-1,-1,-1,   0, 2,-2, 0,  -2, 0, 0, 0,   0, 0, 2, 0,  &
!----------------    59
 0, 2,-2, 0,   0, 0, 0,-2,  -1,-1,-1,-1,  -1, 1, 1, 1,  &
 1,-1, 1, 1,  -1,-1, 1,-1,   0, 0,-2,-2,  -1, 1,-1, 1,  &
 2, 0, 0, 0,   0,-2, 0, 0,  -1, 1,-1, 1,  -1, 1, 1, 1,  &
 1,-1, 1,-1,   1, 1, 1, 1,   0, 2,-2, 0,  -2, 0, 0, 0/
data umats/&  ! Divide all these elements by 2 for simplicity:
 0, 0, 0, 2,   0, 0,-2, 0,   0,-2, 0, 0,   2, 0, 0, 0,  &
 0, 0, 2, 0,   0, 0, 0,-2,   2, 0, 0, 0,   0,-2, 0, 0,  &
 0, 2, 0, 0,   2, 0, 0, 0,   0, 0, 0,-2,   0, 0,-2, 0,  &
 0, 0, 0, 2,   0, 0, 2, 0,   0, 2, 0, 0,   2, 0, 0, 0,  &
 0, 0, 2, 0,   0, 0, 0, 2,   2, 0, 0, 0,   0, 2, 0, 0,  &
 0, 2, 0, 0,   2, 0, 0, 0,   0, 0, 0, 2,   0, 0, 2, 0/

data nei/                      &
!===== 0--3:
18,12,25,43,32,56,36,37,38,42, &
34,28,41,27,14,48,13,21,17,19, &
18,12,23,43,30,49,29,37,33,35, &
34,28,39,27,16,57,20,21,22,26, &
!---- 4--7:
20,54,52,22,40,24,32,25,42,31, &
36,46,50,38,15,40,14,41,19,24, &
13,48,45,17,31,15,30,23,35,40, &
29,55,50,33,24,31,16,39,26,15, &
!---- 8--9
26,57,48,19,43,20,33,38,13,28, &
42,56,53,35,27,36,22,17,29,12, &
!---- 10: 
39,14,23,37,21,30,16,32,25,41, &
!---- 11:
34,34,18,18,18,34,34,18,34,18, &
!==== 12--27:
27, 0, 2, 9,14,13,15,16,24,20, & ! 12
19, 8, 1, 6,15,12,14,17,25,21, &
16, 5,10, 1,12,15,13,18,26,22, &
39, 5, 7, 6,13,14,12,19,27,23, &
!--  
14,10, 7, 3,18,17,19,12,20,24, & ! 16
55, 6, 9, 1,19,16,18,13,21,25, &
34, 0, 2,11,16,19,17,14,22,26, &
13, 1, 5, 8,17,18,16,15,23,27, &
!--
26, 3, 8, 4,22,21,23,24,16,12, & ! 20
37, 1, 3,10,23,20,22,25,17,13, &
46, 9, 4, 3,20,23,21,26,18,14, &
40,10, 6, 2,21,22,20,27,19,15, &
!--  
41, 5, 7, 4,26,25,27,20,12,16, & ! 24
31, 4,10, 0,27,24,26,21,13,17, &
20, 7, 3, 8,24,27,25,22,14,18, &
12, 1, 3, 9,25,26,24,23,15,19, &
!----- 28--43:
43, 1, 3, 8,30,29,31,32,40,36, & !28
35, 9, 2, 7,31,28,30,33,41,37, &
32, 6,10, 2,28,31,29,34,42,38, &
25, 6, 4, 7,29,30,28,35,43,39, &
!--
30,10, 4, 0,34,33,35,28,36,40, & ! 32
54, 7, 8, 2,35,32,34,29,37,41, &
18, 1, 3,11,32,35,33,30,38,42, &
29, 2, 6, 9,33,34,32,31,39,43, &
!--
42, 0, 9, 5,38,37,39,40,32,28, & ! 36
21, 2, 0,10,39,36,38,41,33,29, &
50, 8, 5, 0,36,39,37,42,34,30, &
15,10, 7, 3,37,38,36,43,35,31, &
!--   
23, 6, 4, 5,42,41,43,36,28,32, & ! 40
24, 5,10, 1,43,40,42,37,29,33, &
36, 4, 0, 9,40,43,41,38,30,34, &
28, 2, 0, 8,41,42,40,39,31,35, &
!------ 44--59:
53, 9, 4, 6,45,46,47,56,48,52, & ! 44
17, 6, 0, 4,44,47,46,57,49,53, &
22, 1, 9, 5,47,44,45,58,50,54, &
38, 6, 8, 2,46,45,44,59,51,55, &
!--
17, 8, 6, 1,49,50,51,52,44,56, & ! 48
33, 2, 7, 9,48,51,50,53,45,57, &
38, 7, 3, 5,51,48,49,54,46,58, &
58, 7, 5, 8,50,49,48,55,47,59, &
!--   
22, 4, 2, 6,53,54,55,48,56,44, & ! 52
44, 9, 6, 4,52,55,54,49,57,45, &
33, 4, 8, 0,55,52,53,50,58,46, &
17, 3, 9, 7,54,53,52,51,59,47, &
!-- 
38, 0, 5, 9,57,58,59,44,52,48, & ! 56
22, 8, 4, 3,56,59,58,45,53,49, &
51, 5, 7, 8,59,56,57,46,54,50, &
33, 5, 1, 7,58,57,56,47,55,51/
data dcol10/ &
!==== 0--3:
 4, 3,13, 4,14, 0, 0, 3, 2, 5, &
 8, 6,11, 8,13, 0, 0, 6, 4,10, & ! previous row *2
 1,12, 7, 1,11, 0, 0,12, 8, 5, & !
 2, 9,14, 2, 7, 0, 0, 9, 1,10, & !
!---- 4--7:
13, 2, 1, 7, 1,14, 0, 0, 2, 6, & ! previous row *2, except cols 1 and 2
11, 4, 2,14, 2,13, 0, 0, 4,12, &
 7, 3, 4,13, 4,11, 0, 0, 8, 9, &
14, 1, 3,11, 8, 7, 0, 0, 1, 3, &
!---- 8--9:
 2, 1, 4, 8, 5, 1, 9, 6, 4, 0, &
 4, 2, 3, 1,10, 2, 3,12, 8, 0, &
!---- 10:
11,14,13,10, 5,13,11, 7, 7,14, &
!---- 11:
 2, 8,13,10, 7,11,14, 1, 5, 4/
data dcol12/ &
!===== 12--27:
10,12, 3, 0, & ! 12
 4,11, 0, 8, & ! 13
12, 0, 1, 2, & ! 14
12,13,12, 4, & ! 15 
!--
 3, 4, 0, 8, & ! 16
 1, 2, 3,11, & ! 17
10,11,14, 2, & ! 18
11, 5,11, 7, & ! 19
!--
 1, 0,14, 2, & ! 20
 5, 9, 6,10, & ! 21
 4,12, 8,14, & ! 22
 9, 2, 0, 8, & ! 23
!--  
 3, 3, 7, 1, & ! 24
 6, 0, 8, 2, & ! 25
14,14, 5,13, & ! 26
 5, 7,13, 5, & ! 27
!------ 28--43:
 5, 9, 6, 0, & ! 28
 8, 7, 0, 1, & ! 29
 9, 0, 2, 4, & ! 30
 9,11, 9, 8, & ! 31
!--
 6, 8, 0, 1, & ! 32
 2, 4, 6, 7, & ! 33
 5, 7,13, 1, & ! 34
 7,10, 7,14, & ! 35
!--
 2, 0,13, 4, & ! 36
10, 3,12, 5, & ! 37
 3, 9, 1,13, & ! 38
 3, 4, 0, 1, & ! 39
!--
 6, 6,14, 2, & ! 40
12, 0, 1, 4, & ! 41
13,13,10,11, & ! 42
10,14,11,10, & ! 43
!------- 44--59:
 1, 3, 4, 2, & ! 44
 9,11, 5, 9, & ! 45
11, 5, 8,11, & ! 46
 7, 7, 1,10, & ! 47
!--
 4,11,12, 0, & ! 48
 8, 0, 9, 7, & ! 49
12,12,10,13, & ! 50
 2, 4, 8, 6, & ! 51
!--
 6,14, 5, 6, & ! 52
 4,12, 1, 8, & ! 53
13,13, 4,10, & ! 54
14, 5, 2,14, & ! 55
!--
 2, 0, 6,13, & ! 56
 1,14, 3, 0, & ! 57
 3, 1, 2, 9, & ! 58
 3, 3,10, 7/   ! 59
data nei0a/45,54,  46,59,  52,47,  55,50/  ! k=0--3
data nei0b/57,53,  44,45,  58,56,  59,51,& ! k=4--5
           44,47,  53,52,  51,49,  58,59,& ! k=6--7
           54,58,  47,51,  44,46,  55,49/  ! k=8--9
data nei17/48,45/
data nei22/57,52/
data nei33/59,49/
data nei38/56,47/
data jcora/6,3, 2,5, 6,3, 2,5/   ! k=0--3
data jcorb/6,3,6,3, 2,5,2,5, 4,1,6,3, 2,5,6,3, 6,3,6,3, 2,5,6,3/
data tcors/2,0,0,0,    0,2,0,0,     0,0,2,0,   0,0,0,2, & ! twice the identity
           1,1,-1,-1,  1,-1,-1,1,  -1,1,-1,1,  1,1,1,1, &      ! A_1
           1,-1,-1,-1,  -1,-1,-1,1,  1,-1,1,1,  -1,-1,1,-1, &  ! A_2
           1,-1,1,-1,  -1,-1,-1,-1,  -1,-1,1,1,  -1,1,1,-1, &  ! B_1
           1,-1,1,1,  1,1,-1,1,  1,-1,-1,-1,  1,1,1,-1, &      ! B_2
           1,1,1,1,  -1,1,-1,1,  1,-1,-1,1,  1,1,-1,-1,  &     ! C_1
           1,1,-1,1,  1,-1,1,1,  -1,-1,-1,1,  -1,1,1,1,  &
           2,0,2,0,   2,2,0,2,  0,0,0,2,  -2,-2,-2,-2,   &   ! to 11,    jcol=1
           2,0,2,2,   2,0,0,0,  -2,-2,-2,-2,  -2,0,0,-2, &   ! to 11     jcol=2
           0,2,0,0,  -2,0,-2,0,  2,0,0,2,  0,-2,0,-2,    &   ! to 11     jcol=3
           2,2,0,2,  -2,0,-2,-2,  0,-2,0,-2,  0,0,2,0,   &   ! to 11     jcol=4
           1,1,1,-1,  -1,1,1,1,  -1,-1,1,-1,  1,-1,1,1,  &   ! >11 to>43,jcol=1
           1,-1,-1,1,  1,1,-1,-1,  1,1,1,1,  -1,1,-1,1/      ! >11 to>43,jcol=2
data kcor10a5/0,2,1, 0,1,2, 0,2,1, 0,1,2/
data kcor10b1/0,1,2, 0,2,1, 1,2,0, 0,2,1, 1,0,2, 1,2,0/
data kcor10b2/0,2,1, 0,1,2, 0,2,1, 1,2,0, 0,1,2, 2,1,0/

data kcor12b0/0,1,2,2, 1,2,0,0, 2,0,1,2, 1,1,0,0, &
              0,1,2,2, 1,2,0,0, 2,0,1,2, 1,1,0,0, &
              0,1,2,2, 0,1,0,1, 1,0,2,2, 1,0,0,0/
data kcor17c0/0,1,2/
data kcor22c0/2,1,0/
data kcor33c0/0,2,1/
data kcor38c0/0,1,2/
data kcor44c0/1,0,2/
data kcor51c0/2,1,0/
data kcor53c0/1,0,2/
data kcor58c0/1,0,2/
data twt10a5/ &
 0,-1,-1, 0,-1, 2, 0, 0, 1,-1, & !   
 0,-1, 0,-1,-1, 2,-1, 1, 0, 0, & !   
 1, 0,-1,-1, 0, 2,-1, 0, 0,-1/   !
data twt10b1/ &
 0, 2, 0,-1,-1,-1, 1,-1, 0, 0, & !   
 1, 2, 0,-1, 0, 0, 0,-1,-1,-1, & !   
 0, 2, 1, 0,-1,-1, 0, 0,-1,-1/
data twt10b2/ &
-1, 0, 2, 1, 0,-1,-1, 0, 0,-1, & !   
-1, 0, 2, 0,-1, 0,-1, 1,-1, 0, & !   
 0, 1, 2, 0,-1,-1, 0, 0,-1,-1/   !
data twt12c0/ &
 2, 0, 1, 0,-1, 0,-1,-1, 0,-1, & !   0    
 2, 0, 0, 1, 0,-1,-1, 0,-1,-1, & !   0
 2, 1, 0, 0,-1,-1, 0,-1,-1, 0/   !   0
data qwt10a/                                        &
! --------------------------------------------   0
 2, 0,-1, 0, 1, 0,-1,-1,-1, 0, & !   0
 0, 2, 1, 0,-1,-1, 0, 0,-1,-1, & !   1
-1, 0, 2, 1, 0,-1,-1, 0, 0,-1, & !   2
 0,-1, 0, 2, 1,-1,-1,-1, 0, 0, & !   3
 0,-1,-1, 0, 2,-1, 0, 0,-1, 1, & !   4
 0,-1,-1, 0,-1, 2, 0, 0, 1,-1, & !   5
-1, 0,-1, 0,-1, 0, 2,-1, 1, 0, & !   6
-1, 0, 1, 0,-1, 0,-1, 2,-1, 0, & !   7
 0,-1,-1, 0,-1, 1, 0, 0, 2,-1, & !   8
-1,-1, 0,-1, 0, 0, 0, 1,-1, 2/   !   9
data qwt10b/                   &
! --------------------------------------------   4
 2, 0,-1,-1, 0, 1,-1, 0, 0,-1, & !   0
 0, 2, 0,-1,-1,-1, 1,-1, 0, 0, & !   1
-1, 0, 2, 1, 0,-1,-1, 0, 0,-1, & !   2
-1, 0, 1, 2, 0,-1,-1, 0, 0,-1, & !   3
 0,-1, 0, 1, 2,-1,-1,-1, 0, 0, & !   4
 0,-1,-1, 0,-1, 2, 0, 0, 1,-1, & !   5
-1, 0,-1,-1, 0,-1, 2, 0, 0, 1, & !   6
-1,-1, 0,-1, 0, 0, 0, 2,-1, 1, & !   7
-1, 0,-1, 0,-1, 0, 1,-1, 2, 0, & !   8
-1,-1, 0,-1, 0, 0, 0, 1,-1, 2/   !   9
data qwt10c/                   &
! --------------------------------------------   8
 2, 0,-1,-1, 0, 1,-1, 0, 0,-1, & !   0
 1, 2, 0,-1, 0, 0, 0,-1,-1,-1, & !   1
-1, 0, 2, 1, 0,-1,-1, 0, 0,-1, & !   2
-1,-1, 0, 2, 0, 0, 0,-1, 1,-1, & !   3
 0,-1,-1, 0, 2,-1, 0, 0,-1, 1, & !   4
 1, 0,-1,-1, 0, 2,-1, 0, 0,-1, & !   5
 0, 1, 0,-1,-1,-1, 2,-1, 0, 0, & !   6
-1, 0, 1, 0,-1, 0,-1, 2,-1, 0, & !   7
-1,-1, 0, 1, 0, 0, 0,-1, 2,-1, & !   8
 0,-1,-1, 0, 1,-1, 0, 0,-1, 2/   !   9
data qwt10d/                   &
! --------------------------------------------  10
 2, 1, 0,-1, 0, 0, 0,-1,-1,-1, & !   0
 0, 2, 0,-1,-1,-1, 1,-1, 0, 0, & !   1
-1, 0, 2, 0,-1, 0,-1, 1,-1, 0, & !   2
 0,-1, 0, 2, 1,-1,-1,-1, 0, 0, & !   3
 0,-1, 0, 1, 2,-1,-1,-1, 0, 0, & !   4
 0,-1, 0,-1,-1, 2,-1, 1, 0, 0, & !   5
 0, 1, 0,-1,-1,-1, 2,-1, 0, 0, & !   6
 0,-1, 0,-1,-1, 1,-1, 2, 0, 0, & !   7
 0,-1,-1, 0,-1, 1, 0, 0, 2,-1, & !   8
-1, 0,-1,-1, 0,-1, 1, 0, 0, 2/   !   9
data qwt10e/                   &
! --------------------------------------------  11
 2, 0,-1, 0, 1, 0,-1,-1,-1, 0, & !   0
 0, 2, 1, 0,-1,-1, 0, 0,-1,-1, & !   1
 0, 1, 2, 0,-1,-1, 0, 0,-1,-1, & !   2
-1,-1, 0, 2, 0, 0, 0,-1, 1,-1, & !   3
 1, 0,-1, 0, 2, 0,-1,-1,-1, 0, & !   4
 0,-1, 0,-1,-1, 2,-1, 1, 0, 0, & !   5
-1, 0,-1,-1, 0,-1, 2, 0, 0, 1, & !   6
 0,-1, 0,-1,-1, 1,-1, 2, 0, 0, & !   7
-1,-1, 0, 1, 0, 0, 0,-1, 2,-1, & !   8
-1, 0,-1,-1, 0,-1, 1, 0, 0, 2/   !   9
data qwt12a/                   & 
! --------------------------------------------  12
 2, 0, 0, 1, 0,-1,-1, 0,-1,-1, & !   0
 1, 2, 0, 0,-1,-1, 0,-1,-1, 0, & !   1
 1, 0, 2, 0,-1, 0,-1,-1, 0,-1, & !   2
 1, 0, 0, 2, 0,-1,-1, 0,-1,-1, & !   3
-1,-1,-1,-1, 2, 1, 1, 0, 0, 0, & !   4
-1,-1,-1,-1, 1, 2, 1, 0, 0, 0, & !   5
-1,-1,-1,-1, 1, 1, 2, 0, 0, 0, & !   6
-1,-1,-1,-1, 0, 0, 0, 2, 1, 1, & !   7
-1,-1,-1,-1, 0, 0, 0, 1, 2, 1, & !   8
-1,-1,-1,-1, 0, 0, 0, 1, 1, 2/   !   9
data qwt12b/                   &
! --------------------------------------------  44
 2, 0, 0, 1, 0,-1,-1, 0,-1,-1, & !   0
 1, 2, 0, 0,-1,-1, 0,-1,-1, 0, & !   1
 1, 0, 2, 0,-1, 0,-1,-1, 0,-1, & !   2
 1, 0, 0, 2, 0,-1,-1, 0,-1,-1, & !   3
-1,-1,-1,-1, 2, 1, 1, 0, 0, 0, & !   4
-1,-1,-1,-1, 1, 2, 1, 0, 0, 0, & !   5
-1,-1,-1,-1, 1, 1, 2, 0, 0, 0, & !   6
-1,-1,-1,-1, 0, 0, 0, 2, 1, 1, & !   7
-1,-1,-1,-1, 0, 0, 0, 1, 2, 1, & !   8
-1,-1,-1,-1, 0, 0, 0, 1, 1, 2/!      9
data qwt12b0/                 &
 2, 0, 0, 1, 0,-1,-1, 0,-1,-1, & !   0
 2, 1, 0, 0,-1,-1, 0,-1,-1, 0, & !  12
 2, 0, 1, 0,-1, 0,-1,-1, 0,-1/!   0
data tperms/ &
0,1,2,3,4,5,6,7,8,9, &
9,8,1,7,3,0,2,5,6,4, & !   1
6,4,5,1,9,7,8,0,2,3, & !   2
7,3,8,9,1,2,0,5,6,4, & !   3
4,6,3,5,9,7,8,2,0,1, & !   4
8,9,7,2,0,3,1,5,6,4, & !   5
5,2,6,4,9,7,8,3,1,0, & !   6
8,5,7,2,3,6,0,9,1,4, & !   7
1,6,9,7,2,0,8,4,5,3, & !   8
5,0,4,9,7,8,1,3,6,2, & !   9
6,8,3,4,9,1,5,2,0,7, & !  10
0,5,4,6,9,7,8,1,3,2, & !  11
0,7,9,8,2,1,3,5,6,4/   !  12
data perm10/ &
! --------------------------------  0
1,9,8,2,0,6,7,4,5,3, & !   0
9,1,0,3,7,8,6,2,4,5, & !   1
6,4,3,0,1,8,5,7,2,9, & !   2
1,9,8,2,0,6,4,7,5,3, & !   3
4,5,9,7,3,6,2,1,8,0, & !   4
9,7,5,2,8,1,3,6,0,4, & !   5
5,6,4,3,7,2,1,8,0,9, & !   6
9,1,0,3,4,8,6,2,7,5, & !   7
1,9,5,4,6,0,7,2,3,8, & !   8
9,4,3,7,8,1,5,0,6,2, & !   9
! --------------------------------  1
1,9,8,2,0,6,7,4,5,3, & !   0
9,1,0,3,7,8,6,2,4,5, & !   1
6,4,3,0,1,8,5,7,2,9, & !   2
2,5,6,1,0,8,7,4,9,3, & !   3
7,9,5,4,3,8,1,2,6,0, & !   4
4,6,8,2,5,3,1,7,0,9, & !   5
9,8,7,3,4,1,2,6,0,5, & !   6
5,2,0,3,7,6,8,1,4,9, & !   7
2,5,9,7,8,0,4,1,3,6, & !   8
5,7,3,4,6,2,9,0,8,1, & !   9
! --------------------------------  2
2,5,6,1,0,8,4,7,9,3, & !   0
5,2,0,3,4,6,8,1,7,9, & !   1
8,7,3,0,2,6,9,4,1,5, & !   2
2,5,6,1,0,8,7,4,9,3, & !   3
7,9,5,4,3,8,1,2,6,0, & !   4
9,7,5,2,8,1,3,6,0,4, & !   5
9,8,7,3,4,1,2,6,0,5, & !   6
5,2,0,3,7,6,8,1,4,9, & !   7
2,5,9,7,8,0,4,1,3,6, & !   8
5,7,3,4,6,2,9,0,8,1, & !   9
! --------------------------------  3
2,5,6,1,0,8,4,7,9,3, & !   0
5,2,0,3,4,6,8,1,7,9, & !   1
8,7,3,0,2,6,9,4,1,5, & !   2
1,9,8,2,0,6,4,7,5,3, & !   3
4,5,9,7,3,6,2,1,8,0, & !   4
4,6,8,2,5,3,1,7,0,9, & !   5
5,6,4,3,7,2,1,8,0,9, & !   6
9,1,0,3,4,8,6,2,7,5, & !   7
1,9,5,4,6,0,7,2,3,8, & !   8
9,4,3,7,8,1,5,0,6,2, & !   9
! --------------------------------  4
3,4,6,8,7,0,5,1,2,9, & !   0
9,1,6,4,8,7,0,5,3,2, & !   1
7,9,1,0,3,5,8,6,2,4, & !   2
6,1,0,2,5,7,9,3,8,4, & !   3
5,6,1,0,2,4,7,9,3,8, & !   4
4,6,8,2,5,3,1,7,0,9, & !   5
4,5,6,7,3,9,2,1,8,0, & !   6
4,8,9,7,3,6,2,1,5,0, & !   7
5,2,8,9,7,6,0,4,1,3, & !   8
7,6,1,9,8,3,5,0,4,2, & !   9
! --------------------------------  5
3,4,6,8,7,0,5,1,2,9, & !   0
4,3,7,9,5,6,0,8,1,2, & !   1
6,4,3,0,1,8,5,7,2,9, & !   2
6,1,0,2,5,7,9,3,8,4, & !   3
9,8,2,0,1,7,4,5,3,6, & !   4
4,6,8,2,5,3,1,7,0,9, & !   5
7,9,8,4,3,5,1,2,6,0, & !   6
4,8,9,7,3,6,2,1,5,0, & !   7
9,1,6,5,4,8,0,7,2,3, & !   8
4,8,2,5,6,3,9,0,7,1, & !   9
! --------------------------------  6
3,7,8,6,4,0,9,2,1,5, & !   0
0,2,8,9,1,3,5,7,4,6, & !   1
7,9,1,0,3,5,8,6,2,4, & !   2
8,2,0,1,9,4,5,3,6,7, & !   3
9,8,2,0,1,7,4,5,3,6, & !   4
7,8,6,1,9,3,2,4,0,5, & !   5
7,9,8,4,3,5,1,2,6,0, & !   6
7,6,5,4,3,8,1,2,9,0, & !   7
9,1,6,5,4,8,0,7,2,3, & !   8
4,8,2,5,6,3,9,0,7,1, & !   9
! --------------------------------  7
3,7,8,6,4,0,9,2,1,5, & !   0
4,3,7,9,5,6,0,8,1,2, & !   1
8,9,1,6,4,2,7,0,5,3, & !   2
8,2,0,1,9,4,5,3,6,7, & !   3
5,6,1,0,2,4,7,9,3,8, & !   4
7,8,6,1,9,3,2,4,0,5, & !   5
4,5,6,7,3,9,2,1,8,0, & !   6
7,6,5,4,3,8,1,2,9,0, & !   7
5,2,8,9,7,6,0,4,1,3, & !   8
7,6,1,9,8,3,5,0,4,2, & !   9
! --------------------------------  8
3,7,8,6,4,0,9,2,1,5, & !   0
0,1,6,5,2,3,9,4,7,8, & !   1
5,6,1,0,2,7,4,9,3,8, & !   2
8,6,4,3,7,2,1,5,0,9, & !   3
4,6,8,7,3,5,1,2,9,0, & !   4
0,1,6,7,3,2,9,5,8,4, & !   5
3,0,1,9,4,7,2,6,8,5, & !   6
5,2,0,3,7,6,8,1,4,9, & !   7
4,8,2,0,3,6,9,5,1,7, & !   8
1,6,8,2,0,9,4,7,5,3, & !   9
! --------------------------------  9
3,7,8,6,4,0,9,2,1,5, & !   0
0,3,7,8,2,1,4,9,6,5, & !   1
2,0,1,6,5,8,3,9,4,7, & !   2
8,6,4,3,7,2,1,5,0,9, & !   3
7,8,6,4,3,9,2,1,5,0, & !   4
0,1,6,7,3,2,9,5,8,4, & !   5
3,0,2,5,7,4,1,8,6,9, & !   6
9,1,0,3,4,8,6,2,7,5, & !   7
4,8,2,0,3,6,9,5,1,7, & !   8
2,8,6,1,0,5,7,4,9,3, & !   9
! -------------------------------- 10
1,0,3,7,9,6,2,4,5,8, & !   0
5,2,8,7,6,4,0,9,3,1, & !   1
5,6,1,9,7,2,4,0,8,3, & !   2
2,5,4,3,0,8,9,6,7,1, & !   3
7,8,2,0,3,9,6,5,1,4, & !   4
8,9,1,6,7,2,4,0,5,3, & !   5
2,0,3,4,8,5,1,7,6,9, & !   6
3,7,9,8,4,0,5,1,2,6, & !   7
3,7,6,5,4,0,8,1,2,9, & !   8
6,1,9,4,5,7,0,8,3,2, & !   9
! -------------------------------- 11
3,4,5,2,0,7,6,9,8,1, & !   0
7,3,0,1,9,8,4,2,6,5, & !   1
2,0,3,7,8,5,1,4,9,6, & !   2
9,5,4,3,7,1,2,6,0,8, & !   3
0,1,6,4,3,2,9,8,5,7, & !   4
4,6,1,9,5,3,8,0,7,2, & !   5
8,7,9,5,2,6,3,1,4,0, & !   6
1,9,7,8,6,0,5,3,2,4, & !   7
6,8,2,0,1,4,7,5,3,9, & !   8
5,2,8,6,4,9,0,7,1,3/   !   9
data perm12/                           &
! -------------------------------- 12
0,4,7,3,1,9,6,2,8,5, & !   0
2,1,7,3,8,9,6,4,5,0, & !   1
2,7,1,3,4,0,5,8,6,9, & !   2
4,3,0,9,7,5,2,6,1,8, & !   3
! -------------------------------- 13
0,3,4,7,8,5,2,9,6,1, & !   0
3,8,2,4,0,7,5,9,1,6, & !   1
8,5,6,3,4,9,7,2,1,0, & !   2
5,8,7,0,4,9,3,1,2,6, & !   3
! -------------------------------- 14
0,9,1,6,5,2,8,4,3,7, & !   0
9,6,7,4,3,5,8,0,2,1, & !   1
6,9,1,8,5,0,4,3,2,7, & !   2
9,6,7,4,3,2,8,0,5,1, & !   3
! -------------------------------- 15
0,5,2,8,9,1,6,7,3,4, & !   0
3,4,2,8,6,7,9,5,1,0, & !   1
7,2,9,5,8,6,1,0,4,3, & !   2
8,3,6,5,7,9,2,0,1,4, & !   3
! -------------------------------- 16
0,2,5,8,7,4,3,9,6,1, & !   0
1,6,0,2,3,5,8,7,4,9, & !   1
9,7,6,4,0,1,2,3,8,5, & !   2
9,7,6,4,0,1,5,3,8,2, & !   3
! -------------------------------- 17
0,5,2,8,7,3,4,9,1,6, & !   0
2,3,1,7,5,6,8,9,0,4, & !   1
2,1,7,3,4,9,6,8,5,0, & !   2
5,7,0,8,6,1,9,3,4,2, & !   3
! -------------------------------- 18
0,4,7,3,2,8,5,1,9,6, & !   0
4,0,3,9,7,8,5,6,2,1, & !   1
4,3,0,9,6,1,2,7,5,8, & !   2
1,6,0,2,7,5,9,3,4,8, & !   3
! -------------------------------- 19
0,9,6,1,2,5,8,3,4,7, & !   0
7,9,5,2,3,0,4,1,8,6, & !   1
6,1,8,9,4,3,2,7,5,0, & !   2
8,6,5,3,2,7,1,4,0,9, & !   3
! -------------------------------- 20
0,7,3,4,5,2,8,6,1,9, & !   0
8,6,5,3,2,0,1,4,7,9, & !   1
0,1,5,4,9,7,2,3,8,6, & !   2
5,7,8,0,1,6,2,4,3,9, & !   3
! -------------------------------- 21
0,7,4,3,1,6,9,2,5,8, & !   0
2,7,1,3,8,0,5,4,6,9, & !   1
2,1,7,3,4,9,6,8,5,0, & !   2
3,8,2,4,9,7,6,0,1,5, & !   3
! -------------------------------- 22
0,2,5,8,9,6,1,7,4,3, & !   0
1,6,2,0,5,3,8,4,7,9, & !   1
2,1,3,7,9,4,0,5,8,6, & !   2
5,0,7,8,3,2,4,6,9,1, & !   3
! -------------------------------- 23
0,9,1,6,5,2,8,4,3,7, & !   0
7,2,5,9,6,0,1,4,8,3, & !   1
9,6,7,4,3,2,1,0,5,8, & !   2
3,8,4,2,7,9,5,1,0,6, & !   3
! -------------------------------- 24
0,1,9,6,4,7,3,5,8,2, & !   0
7,9,2,5,0,3,4,8,1,6, & !   1
3,2,4,8,5,0,1,6,9,7, & !   2
8,6,3,5,0,4,1,7,2,9, & !   3
! -------------------------------- 25
0,2,5,8,7,4,3,9,6,1, & !   0
9,7,6,4,0,8,5,3,1,2, & !   1
5,7,8,0,4,3,2,1,6,9, & !   2
3,4,8,2,1,6,0,7,5,9, & !   3
! -------------------------------- 26
0,8,5,2,3,4,7,1,6,9, & !   0
6,8,1,9,7,0,5,4,2,3, & !   1
7,5,9,2,1,6,8,3,4,0, & !   2
5,8,7,0,4,9,3,1,2,6, & !   3
! -------------------------------- 27
0,4,7,3,1,9,6,2,8,5, & !   0
4,3,0,9,7,1,2,6,5,8, & !   1
4,0,3,9,6,8,5,7,2,1, & !   2
9,7,6,4,3,8,2,0,1,5, & !   3
! -------------------------------- 28
0,4,7,3,1,9,6,2,8,5, & !   0
2,1,7,3,8,9,6,4,5,0, & !   1
2,7,1,3,4,0,5,8,6,9, & !   2
4,0,3,9,6,8,1,7,2,5, & !   3
! -------------------------------- 29
0,3,4,7,8,5,2,9,6,1, & !   0
3,8,2,4,0,7,5,9,1,6, & !   1
8,5,6,3,4,9,7,2,1,0, & !   2
5,8,7,0,4,9,3,1,2,6, & !   3
! -------------------------------- 30
0,9,1,6,5,2,8,4,3,7, & !   0
9,6,7,4,3,5,8,0,2,1, & !   1
7,2,5,9,6,8,3,4,0,1, & !   2
9,6,7,4,3,2,8,0,5,1, & !   3
! -------------------------------- 31
0,9,1,6,5,2,8,4,3,7, & !   0
3,4,2,8,6,7,9,5,1,0, & !   1
7,2,9,5,8,6,1,0,4,3, & !   2
8,3,6,5,7,9,2,0,1,4, & !   3
! -------------------------------- 32
0,2,5,8,7,4,3,9,6,1, & !   0
5,7,8,0,4,6,9,1,3,2, & !   1
9,7,6,4,0,1,2,3,8,5, & !   2
9,7,6,4,0,1,5,3,8,2, & !   3
! -------------------------------- 33
0,8,2,5,6,1,9,4,3,7, & !   0
2,3,1,7,5,6,8,9,0,4, & !   1
1,2,6,0,4,9,7,5,8,3, & !   2
5,7,0,8,6,1,9,3,4,2, & !   3
! -------------------------------- 34
0,7,4,3,1,6,9,2,5,8, & !   0
4,0,3,9,7,8,5,6,2,1, & !   1
4,3,0,9,6,1,2,7,5,8, & !   2
9,7,4,6,8,3,5,1,0,2, & !   3
! -------------------------------- 35
0,9,6,1,2,5,8,3,4,7, & !   0
7,9,5,2,3,0,4,1,8,6, & !   1
6,1,8,9,4,3,2,7,5,0, & !   2
8,6,5,3,2,7,1,4,0,9, & !   3
! -------------------------------- 36
0,7,3,4,5,2,8,6,1,9, & !   0
8,6,5,3,2,0,1,4,7,9, & !   1
0,1,5,4,9,7,2,3,8,6, & !   2
5,7,8,0,1,6,2,4,3,9, & !   3
! -------------------------------- 37
0,4,7,3,2,8,5,1,9,6, & !   0
2,7,1,3,8,0,5,4,6,9, & !   1
2,1,7,3,4,9,6,8,5,0, & !   2
4,9,0,3,2,1,7,8,5,6, & !   3
! -------------------------------- 38
0,4,3,7,9,1,6,8,2,5, & !   0
2,7,1,3,8,0,5,4,6,9, & !   1
2,1,3,7,9,4,0,5,8,6, & !   2
5,0,7,8,3,2,4,6,9,1, & !   3
! -------------------------------- 39
0,5,2,8,9,1,6,7,3,4, & !   0
1,0,6,2,7,8,5,3,9,4, & !   1
9,6,7,4,3,2,1,0,5,8, & !   2
3,8,4,2,7,9,5,1,0,6, & !   3
! -------------------------------- 40
0,2,5,8,7,4,3,9,6,1, & !   0
7,9,2,5,0,3,4,8,1,6, & !   1
3,2,4,8,5,0,1,6,9,7, & !   2
8,6,3,5,0,4,1,7,2,9, & !   3
! -------------------------------- 41
0,1,9,6,4,7,3,5,8,2, & !   0
9,7,6,4,0,8,5,3,1,2, & !   1
6,1,9,8,3,4,0,5,7,2, & !   2
3,4,8,2,1,6,0,7,5,9, & !   3
! -------------------------------- 42
0,8,5,2,3,4,7,1,6,9, & !   0
6,8,1,9,7,0,5,4,2,3, & !   1
7,5,9,2,1,6,8,3,4,0, & !   2
5,8,7,0,4,9,3,1,2,6, & !   3
! -------------------------------- 43
0,4,7,3,1,9,6,2,8,5, & !   0
4,3,0,9,7,1,2,6,5,8, & !   1
4,0,3,9,6,8,5,7,2,1, & !   2
9,6,7,4,0,5,1,3,2,8, & !   3
! -------------------------------- 44
0,5,8,2,3,7,4,1,9,6, & !   0
2,1,3,7,5,4,0,9,8,6, & !   1
1,6,2,0,4,3,8,5,7,9, & !   2
2,3,7,1,0,5,4,6,9,8, & !   3
! -------------------------------- 45
0,1,6,9,7,4,3,8,5,2, & !   0
3,2,8,4,9,5,7,0,6,1, & !   1
0,4,5,1,6,8,3,2,7,9, & !   2
7,9,5,2,1,0,6,3,8,4, & !   3
! -------------------------------- 46
0,6,1,9,8,2,5,7,3,4, & !   0
7,5,2,9,6,3,8,4,1,0, & !   1
6,8,1,9,7,2,3,4,0,5, & !   2
6,8,9,1,0,4,5,2,7,3, & !   3
! -------------------------------- 47
0,9,1,6,4,3,7,5,2,8, & !   0
6,1,9,8,3,7,2,5,4,0, & !   1
7,9,2,5,8,3,4,0,1,6, & !   2
7,9,2,5,0,1,4,8,3,6, & !   3
! -------------------------------- 48
0,4,7,3,2,8,5,1,9,6, & !   0
3,2,4,8,6,0,1,5,9,7, & !   1
0,4,1,5,8,6,9,7,2,3, & !   2
8,6,3,5,0,4,1,7,2,9, & !   3
! -------------------------------- 49
0,3,7,4,6,9,1,5,8,2, & !   0
8,5,3,6,9,2,7,1,4,0, & !   1
0,5,1,4,3,2,7,9,6,8, & !   2
3,8,4,2,7,9,5,1,0,6, & !   3
! -------------------------------- 50
0,5,8,2,1,9,6,3,7,4, & !   0
7,2,5,9,4,8,3,6,0,1, & !   1
0,1,5,4,9,7,2,3,8,6, & !   2
3,4,8,2,1,6,0,7,5,9, & !   3
! -------------------------------- 51
0,2,5,8,7,4,3,9,6,1, & !   0
2,1,7,3,8,9,6,4,5,0, & !   1
1,0,2,6,9,7,5,8,3,4, & !   2
1,6,0,2,7,5,9,3,4,8, & !   3
! -------------------------------- 52
0,2,8,5,4,7,3,6,9,1, & !   0
3,2,8,4,9,5,7,0,6,1, & !   1
0,4,5,1,6,8,3,2,7,9, & !   2
7,9,5,2,1,0,6,3,8,4, & !   3
! -------------------------------- 53
0,5,8,2,3,7,4,1,9,6, & !   0
1,2,0,6,8,4,3,9,5,7, & !   1
1,6,2,0,4,3,8,5,7,9, & !   2
2,3,7,1,0,5,4,6,9,8, & !   3
! -------------------------------- 54
0,5,2,8,7,3,4,9,1,6, & !   0
6,1,9,8,3,7,2,5,4,0, & !   1
6,9,1,8,5,0,4,3,2,7, & !   2
7,9,2,5,0,1,4,8,3,6, & !   3
! -------------------------------- 55
0,8,2,5,6,1,9,4,3,7, & !   0
7,5,2,9,6,3,8,4,1,0, & !   1
7,5,2,9,6,1,0,4,3,8, & !   2
6,8,9,1,0,4,5,2,7,3, & !   3
! -------------------------------- 56
0,3,4,7,8,5,2,9,6,1, & !   0
8,5,3,6,9,2,7,1,4,0, & !   1
0,5,1,4,3,2,7,9,6,8, & !   2
0,5,4,1,6,9,8,2,3,7, & !   3
! -------------------------------- 57
0,7,4,3,1,6,9,2,5,8, & !   0
0,1,4,5,7,3,2,8,9,6, & !   1
0,4,1,5,8,6,9,7,2,3, & !   2
8,6,3,5,0,4,1,7,2,9, & !   3
! -------------------------------- 58
0,4,7,3,1,9,6,2,8,5, & !   0
2,1,7,3,8,9,6,4,5,0, & !   1
1,0,2,6,9,7,5,8,3,4, & !   2
2,7,3,1,6,8,9,0,4,5, & !   3
! -------------------------------- 59
0,9,6,1,2,5,8,3,4,7, & !   0
7,2,5,9,4,8,3,6,0,1, & !   1
0,1,5,4,9,7,2,3,8,6, & !   2
3,4,8,2,1,6,0,7,5,9/   !   3
!======
data perms/ &
3,2,1,0,4,6,5,7,8,9, & !   4
2,3,0,1,6,5,4,7,8,9, & !   5
1,0,3,2,5,4,6,7,8,9, & !   6
3,2,1,0,4,5,6,7,9,8, & !   7
2,3,0,1,4,5,6,9,8,7, & !   8
1,0,3,2,4,5,6,8,7,9/   !   9
end module jp_pbfil2
!#
